(function(){
	if (!loadItem("web3js_wallet")){
		alert("您还没有内置钱包，请先创建");
        goto("wallet/addnew");
		return;
	}
	if (publicParam.usewallet=="builtIn"){
		getNode("pswd1").onkeyup=function(){
			if (checkPassword(this.value)) getNode("ok").onclick = go;
			else getNode("ok").onclick = "";
		}
	}else{
		alert("只有使用内置钱包时才可以使用此功能");
	}
	//显示或隐藏密码
	setEye(0);
	setEye(1);
	setEye(2);
	async function go(){
		var pswd0=getNode("pswd0").value;
		var pswd1=getNode("pswd1").value;
		var pswd2=getNode("pswd2").value;
		if (pswd0.length<6){
			setNodeText("errmsg","原密码最少6位");
			return;
		}
		if (pswd1!=pswd2){
			setNodeText("errmsg","验证密码不一致");
			return;
		}
        setLoading(1);
        var rtn = await changePassword(pswd0,pswd1);
        if (rtn){
            alert("密码修改成功，请重新连接");
            goto("home");
        }else{
            setNodeText("errmsg","原密码不正确");
        }
        setLoading(0);
	};
})();